package com.shujia.wyh.day08;

/*
    添加功能
        public StringBuffer append(String str)
        public StringBuffer insert(int offset,String str)
    删除功能
        public StringBuffer deleteCharAt(int index)
        public StringBuffer delete(int start,int end)

 */
public class StringBufferDemo2 {
    public static void main(String[] args) {
        StringBuffer sb = new StringBuffer();
//        StringBuffer sb2 = sb.append(100);

//        System.out.println(sb);
//        System.out.println(sb2);
//        System.out.println(sb==sb2);
        sb.append(100)
                .append(12.34)
                .append(true)
                .append(100L)
                .append(12.34F);

        //无论你append的是什么类型数据，只要进入到了StringBuffer中，就是一个一个的字符
        //StringBuffer中一律是字符
        System.out.println(sb);

        //public StringBuffer insert(int index,String str)
        sb.insert(8,"hello");
        System.out.println(sb);

        //public StringBuffer deleteCharAt(int index)
        sb.deleteCharAt(13);
        System.out.println(sb);

        //public StringBuffer delete(int start,int end) [start,end)
        //删除一部分
        sb.delete(8,16);
        System.out.println(sb);

    }
}
